package cn.zhaoyuening.fanrpc.consumer.core;

import cn.zhaoyuening.fanrpc.common.beans.ServiceBean;
import org.springframework.beans.factory.annotation.Value;

import java.util.HashSet;
import java.util.Set;

public class RpcClientInfo {
    @Value("${funrpc.zookeeper.address}")
    private String ZK_ADDRESS;
    private Set<ServiceBean> rpcServiceSet = new HashSet<ServiceBean>();

    public Set<ServiceBean> addRpcService(Class<?> serivce,String version) {
        rpcServiceSet.add(new ServiceBean().setZlass(serivce.getName()).setVersion(version));
        return rpcServiceSet;
    }

    public Set<ServiceBean> addRpcService(Class<?> serivce) {
        addRpcService(serivce, "v1");
        return rpcServiceSet;
    }

    public Set<ServiceBean> getRpcServiceSet() {
        return rpcServiceSet;
    }

    public String getZK_ADDRESS() {
        return ZK_ADDRESS;
    }
}
